package top.kaoshanji.p1ch01c;

import top.kaoshanji.p1ch01c.exception.DataAccessException;

import java.io.FileInputStream;
import java.io.IOException;

/**
 * 代码清单 p1ch01c-01：使用异常包装技术的示例(1.4.2节)
 * 捕获的异常是 IOException，抛出的异常是 DataAccessException
 * author kaoshanji
 * ^_^
 * create time 2024/12/22 17:22
 */
public class DataAccessGateway {

    public void load() throws DataAccessException {

        // 捕获的异常是 IOException
        // 抛出的异常是 DataAccessException
        try {
            FileInputStream input = new FileInputStream("data.txt");
        } catch (IOException e) {
            throw new DataAccessException(e);
        }

    }

}
